package com.zbf1811a.service;

import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author: LCG
 * 作者: LCG
 * 日期: 2021/7/27  17:58
 * 描述:
 */
@Component
public class SendMessageService {

    @Autowired
   private RabbitTemplate rabbitTemplate;


    public void sendMesage(String msg,String exchange,String routingKey,String id){
        CorrelationData correlationData=new CorrelationData();
        correlationData.setId(id);
        rabbitTemplate.convertAndSend(exchange,routingKey,msg,correlationData);
    }

}
